// +build ignore

package main

import (
	"fmt"
	"os"

	"github.com/99designs/gqlgen/api"
	"github.com/99designs/gqlgen/codegen/config"
)

func main() {
	fmt.Println("Deleting gen_resolver.go")
	os.Remove("gen_tmp/gen_resolver.go")

	cfg, err := config.LoadConfigFromDefaultLocations()
	if err != nil {
		fmt.Println(err, "faild to load config")
		os.Exit(2)
	}
	fmt.Println("Generating graphql code ...")
	err = api.Generate(cfg)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(3)
	}
}
